<div class="row row-cards row-deck">
  <div class="col-12">
    <div class="card">
      <table class="table table-hover table-outline table-vcenter text-nowrap card-table">
        <thead>
          <tr>
            <th>配送范围</th>
            <th>首N件</th>
            <th>首费</th>
            <th>续M件</th>
            <th>续费</th>
            <th class="text-center">
              <a href="<%= new_shop_fare_template_fare_mode_path(@fare_template) %>">新增运费</a>
            </th>
          </tr>
        </thead>
        <tbody>
          <% @fare_modes.each do |fare_mode| %>
            <tr>
              <td>
                <div>
                  <% if @fare_template.location? %>
                    <% if fare_mode.is_default %>
                      全国默认地区
                    <% else %>
                      <% fare_mode.provinces.each do |province| %>
                        <%= province.name %>、
                      <% end %>
                    <% end %>
                  <% elsif @fare_template.distance? %>
                    <%= fare_mode.min_distance %> - <%= fare_mode.max_distance %> 公里
                  <% elsif @fare_template.weight? %>
                    <%= fare_mode.min_weight %> - <%= fare_mode.max_weight %> 公斤
                  <% end %>
                </div>
              </td>
              <td>
                <div><%= fare_mode.first_n_piece %></div>
              </td>
              <td>
                <div><%= fare_mode.first_amount %></div>
              </td>
              <td>
                <div><%= fare_mode.second_n_piece %></div>
              </td>
              <td>
                <div><%= fare_mode.second_amount %></div>
              </td>
              <td class="text-center">
                <div class="item-action dropdown">
                  <a href="javascript:void(0)" data-toggle="dropdown" class="icon"><i class="fe fe-more-vertical"></i></a>
                  <div class="dropdown-menu dropdown-menu-right">
                    <a href="<%= edit_shop_fare_template_fare_mode_path(@fare_template, fare_mode) %>" class="dropdown-item"><i class="dropdown-icon fe fe-tag"></i> 修改 </a>
                    <%= link_to shop_fare_template_fare_mode_path(@fare_template, fare_mode), method: :delete, class: 'dropdown-item' do %>
                      <i class="dropdown-icon fe fe-edit-2"></i> 删除 
                    <% end %>
                  </div>
                </div>
              </td>
            </tr>
          <% end %>
        </tbody>
      </table>
      <div>
        <%= paginate @fare_modes %>
      </div>
    </div>
  </div>
</div>